import zmq
import random
import time

ctx = zmq.Context.instance()
socket = ctx.socket(zmq.PULL)

socket.connect("tcp://localhost:5557")

sender = ctx.socket(zmq.PUSH)
sender.connect("tcp://localhost:5558")


while True:
    s = socket.recv()
    print s

    time.sleep(int(s)/1000.0)

    sender.send("")

socket.close()
sender.close()
ctx.destroy()
